package com.fare.taluo.core.domain.analyse.monitor;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Table;

import com.dayatang.domain.InstanceFactory;
import com.fare.taluo.base.ddd.domain.baseentity.BaseEntity;

/*
 * @xiaozhi
 * email:ganhongzhi@foreveross.com
 * 运价监控设置entity
*/
@javax.persistence.Entity
@Table(name="FDC_FLIGHT_MONITOR")
public class FreightMonitorSettingsEntity extends BaseEntity{
	private static final long serialVersionUID = 375171077416722709L;
	
//	@Id
//	@Column(name = "ID")
//	@GeneratedValue(strategy = GenerationType.AUTO, generator = FDC_SEQ_GEN)
//	@SequenceGenerator(name = FDC_SEQ_GEN, sequenceName = FDC_SEQUENCE)
//	
//	private Long id;
	//航班日期
	@Column(name="DEPARTDATE")
	private Date departDate;
	//航线起飞城市
	@Column(name="FROMCITY")
	private String fromCity;
	//航线起飞城市
	@Column(name="TOCITY")
	private String toCity;
	//航班
	@Column(name="FLIGHTNUMBER")
	private String flightNumber;
	//创建日期
	@Column(name="OPDATE")
	private Date opDate;
	//HbaseKey
	@Column(name="HBASEKEY")
	private String hbaseKey;
	//出发城市CODE
	@Column(name="FROMCODE")
	private String fromCode;
	//到达城市CODE
	@Column(name="TOCODE")
	private String toCode;
	//区域CODE
	@Column(name="AREACODE")
	private String areaCode;
	
	@Column(name = "COMPANYCODE")
	private String companyCode;
	
	@Column(name = "CURRENTUSER")
	private String currentUser;

//	public FreightMonitorSettingsEntity(){};
	
	private static FreightMonitorSettingsEntityRepository freightMonitorSettingsEntityRepository;
	private static FreightMonitorShowsEntityRepository freightMonitorShowsEntityRepository;
	
	

	public static FreightMonitorShowsEntityRepository getFreightMonitorShowsEntityRepository() {
		if(freightMonitorShowsEntityRepository ==null){
			freightMonitorShowsEntityRepository= InstanceFactory.getInstance(FreightMonitorShowsEntityRepository.class);
		}
		return freightMonitorShowsEntityRepository;
	}

	public static FreightMonitorSettingsEntityRepository getFreightMonitorSettingsEntityRepository() {
		if(freightMonitorSettingsEntityRepository == null){
			freightMonitorSettingsEntityRepository =InstanceFactory.getInstance(FreightMonitorSettingsEntityRepository.class);
		}
		return freightMonitorSettingsEntityRepository;
	}

	//初始化页面
  	public List<FreightMonitorSettingsEntity> findFreightMonitorAll(String currentUser) throws Exception{
  		return getFreightMonitorSettingsEntityRepository().findFreightMonitorAll(currentUser);
  	}
  	//@id查找运价监控相关数据
  	public List<FreightMonitorSettingsEntity> findByLine(Long id){
  		return getFreightMonitorShowsEntityRepository().findByLine(id);
  	}
  	//监控页面初始化
  	public List<FreightMonitorSettingsEntity> findFreightMonitorAlls(){
  		return getFreightMonitorShowsEntityRepository().findFreightMonitorAlls();
  	}
  	//删除其中一条数据
  	public void delete(FreightMonitorSettingsEntity entity){
  		getFreightMonitorSettingsEntityRepository().delete(entity);
	}
  //保存
  	public void save(FreightMonitorSettingsEntity entity) throws Exception{
  		
//  		super.getRepository().save(this);
  		//产生预警任务队列
//  		FreightMonitorSettingsEntity queueEntity = new FreightMonitorSettingsEntity();
//  		queueEntity.setId(this.getId());
//  		queueEntity.setDepartDate(this.departDate);
//  		queueEntity.setFromCity(this.fromCity);
//  		queueEntity.setToCity(this.toCity);
//  		queueEntity.setFlightNumber(this.flightNumber);
//  		queueEntity.setOpDate(this.opDate);
  		getFreightMonitorSettingsEntityRepository().save(entity);
  	}
  //条件查找
  	public List<FreightMonitorSettingsEntity> findOccupRateEntityByCondition(Date queryDate,Date toQueryDate,String fromCity,String toCity,Date createTime,Date toCreateTime,String currentUsers){
  		return getFreightMonitorSettingsEntityRepository().findFreightMonitorSettingsEntityByCondition(queryDate,toQueryDate,fromCity,toCity,createTime,toCreateTime,currentUsers);
  	}
  	
  //根据主键查询
  	public FreightMonitorSettingsEntity getMonitorsById(Long id){
  		return getFreightMonitorSettingsEntityRepository().get(FreightMonitorSettingsEntity.class, id);
  	}
  	//添加
  	public void saveMonitors(FreightMonitorSettingsEntity entity){
  		getFreightMonitorSettingsEntityRepository().save(entity);
  	}
	
//	public Long getId() {
//		return id;
//	}
//
//	public void setId(Long id) {
//		this.id = id;
//	}

	public Date getDepartDate() {
		return departDate;
	}

	public void setDepartDate(Date departDate) {
		this.departDate = departDate;
	}
	
	public String getFromCity() {
		return fromCity;
	}

	public void setFromCity(String fromCity) {
		this.fromCity = fromCity;
	}

	public String getToCity() {
		return toCity;
	}

	public void setToCity(String toCity) {
		this.toCity = toCity;
	}

	public String getFlightNumber() {
		return flightNumber;
	}

	public void setFlightNumber(String flightNumber) {
		this.flightNumber = flightNumber;
	}

	public Date getOpDate() {
		return opDate;
	}

	public void setOpDate(Date opDate) {
		this.opDate = opDate;
	}

	public String getHbaseKey() {
		return hbaseKey;
	}

	public void setHbaseKey(String hbaseKey) {
		this.hbaseKey = hbaseKey;
	}

	public String getFromCode() {
		return fromCode;
	}

	public void setFromCode(String fromCode) {
		this.fromCode = fromCode;
	}

	public String getToCode() {
		return toCode;
	}

	public void setToCode(String toCode) {
		this.toCode = toCode;
	}

	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public String getCompanyCode() {
		return companyCode;
	}

	public void setCompanyCode(String companyCode) {
		this.companyCode = companyCode;
	}

	public String getCurrentUser() {
		return currentUser;
	}

	public void setCurrentUser(String currentUser) {
		this.currentUser = currentUser;
	}
}
